package com.funny.stock.base.util;

import org.springframework.data.domain.PageRequest;

/**
 * @author pengl
 * @date 2020/05/17
 **/
public class PageUtil {


    public static PageRequest buildPageRequest(Integer pageNumber, Integer pageSize){
        if(pageNumber == null || pageNumber <= 0)
            pageNumber = 1;

        if(pageSize == null || pageSize <= 0)
            pageSize = 20;

        return PageRequest.of(pageNumber - 1,pageSize);
    }
}
